package net.prasenjit.test.webflow.model;

import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Form implements Serializable {
    private static final long serialVersionUID = 9092159004343536406L;

    private List<String> name;
    private String addedName;

    public Form() {
        System.out.println("form created");
    }

    public boolean process() {
        getName().add(addedName);
        return true;
    }

    public List<String> getName() {
        if (CollectionUtils.isEmpty(name)) {
            name = new ArrayList<>();
        }
        return name;
    }

    public void setName(List<String> name) {
        this.name = name;
    }

    public String getAddedName() {
        return addedName;
    }

    public void setAddedName(String addedName) {
        this.addedName = addedName;
    }
}
